Você pode usar ntile .
Alguns códigos de exemplo:
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
Experimente em SE-Data .