;With cteRn As
(Select Id, Startdate, ColA, ColB,
Row_Number() Over(Order By Startdate, Id) As rn
From @Sample),
cteIndex As
(Select r.Id, r.Startdate, r.ColA, r.ColB, r.rn, 1 As [Index]
From cteRn r
Where r.rn = 1
Union All
Select r.Id, r.Startdate, r.ColA, r.ColB, r.rn,
Case When i.ColA = r.ColA And i.ColB = r.ColB Then i.[Index] Else i.[Index] + 1 End As [Index]
From cteIndex i
Inner Join cteRn r On i.rn+1 = r.rn)
Select Id, Startdate, ColA, ColB, [Index]
From cteIndex;
Tom