To put s.no in grid we can select serial no in query to use over function like below
Select *,ROW_NUMBER() OVER (ORDER BY st_id) As SrNo from
(
select distinct(scd.St_id),IncBr.Cyear,tick=0 /*case isnull(cyear,0) when 0 then 0 else 1 end*/ from sem_cadata scd
left join tblmytest IncBr on scd.st_id=IncBr.st_id and scd.sem=IncBr.Esem and scd.c_year=IncBr.Eyear
where
----scd.sem=@sem and scd.c_year=@year
scd.sem + '-' + cast(scd.c_year as varchar)=@semester
) t
order by st_id
Select *,ROW_NUMBER() OVER (ORDER BY st_id) As SrNo from
(
select distinct(scd.St_id),IncBr.Cyear,tick=0 /*case isnull(cyear,0) when 0 then 0 else 1 end*/ from sem_cadata scd
left join tblmytest IncBr on scd.st_id=IncBr.st_id and scd.sem=IncBr.Esem and scd.c_year=IncBr.Eyear
where
----scd.sem=@sem and scd.c_year=@year
scd.sem + '-' + cast(scd.c_year as varchar)=@semester
) t
order by st_id