A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
;with cteResult as (select ID, Name, DENSE_RANK() over (partion by ID order by name) as Count from @t)
select * from cteResult order by ID, Name
The only problem is that it would not be exactly the same result as you shown.