Puede usar ntile .
Algunos ejemplos de código:
declare @NumberOfStudents int
declare @StudentsPerGroup int
set @StudentsPerGroup = 10
set @NumberOfStudents = 104
select StudentID,
ntile(@NumberOfStudents / @StudentsPerGroup) over(order by StudentID) as GroupID
from Students
Pruébelo en SE-Data .