Vertical data set to horizontal data set for many columns
create table Vertical(FID int ,[SID]int ,OAID int,FN varchar(10),[Row] int)

insert into Vertical(FID ,[SID],OAID ,FN ,[Row] ) values(3184226,9304,82,'8090',1)
insert into Vertical(FID ,[SID],OAID ,FN ,[Row] ) values(3200394,4140,81,'0016',2)
insert into Vertical(FID ,[SID],OAID ,FN ,[Row] ) values(3203126,10465,81,'0426',3)
insert into Vertical(FID ,[SID],OAID ,FN ,[Row] ) values(3136790,10822,81,'0029',4)

    select 
        OAID,
        case when FID_1 is null then FID_2 else FID_1 end  as FID_1,
        case when SID_1 is null then SID_2 else SID_1 end as SID_1,
        case when FN_1 is null then FN_2 else FN_1 end as FN_1,

        case when FID_1 is null then FID_3 else FID_2 end  as FID_2,
        case when SID_1 is null then SID_3 else SID_2 end as SID_2,
        case when FN_1 is null then FN_3 else FN_2 end as FN_2,

        case when FID_1 is null then FID_4 else FID_3 end  as FID_3,
        case when SID_1 is null then SID_4 else SID_3 end as SID_3,
        case when FN_1 is null then FN_4 else FN_3 end as FN_3

    from (
    select OAID,
        min([1]) as FID_1,
        min(SID_1) as SID_1,
        min(FN_1) as FN_1,

        min([2]) as FID_2,
        min(SID_2) as SID_2,
        min(FN_2) as FN_2,

        min([3]) as FID_3,
        min(SID_3)  as SID_3,
        min(FN_3) as FN_3,

        min([4] )as FID_4 ,
        min(SID_4) as SID_4 ,
        min(FN_4) as FN_4

    from 
    (
    select FID,OAID, [1] as FN_1,[2] as FN_2,[3] as FN_3,[4] as FN_4 ,SID_1,SID_2,SID_3,SID_4,rn_2 from 
    (
    select  
            FID,
            OAID,
            FN,
            [1] as SID_1,
            [2] as SID_2,
            [3] as SID_3,
            [4]  as SID_4 
            ,rn_1
            ,rn_2 
    from (select *,ROW_NUMBER() over(order by OAID desc,SID) as rn_1,ROW_NUMBER() over(order by OAID desc,SID) as rn_2 from Vertical )as v 
    pivot(min([SID]) for [Row] in([1],[2],[3],[4])) as p

    )as P
    pivot(min([FN]) for rn_1 in([1],[2],[3],[4])) as p

    )as P
    pivot(min([FID]) for rn_2 in([1],[2],[3],[4])) as p

    group by OAID
    )as A