How do I get the row as column and one of the column as rows under the first column data I have table like below:

Tname         Scode
-----         -----
SVC           code1
SVC           code2
SVC           code3
AKV           code1
AKV           code12
AKV           code3
AKS           code3
AKS           code2
AKS           code1


I would want a result like below:

SVC      AKV         AKS
----     -----       ----
code1    code1       code3
code2    code12      code2
code3    code3       code1
Use Inner Join to display the three queries horizontally. Then use Row_number for setting join conditions, 

As a demo:-

create table #temp (Tname varchar(10) , Scode varchar(10))
insert into #temp values ('SVC','code1')
insert into #temp values ('SVC','code2')
insert into #temp values ('SVC','code3')
insert into #temp values ('AKV','code1')
insert into #temp values ('AKV','code12')
insert into #temp values ('AKV','code3')
insert into #temp values ('AKS','code3')
insert into #temp values ('AKS','code2')
insert into #temp values ('AKS','code1')

go 

SELECT SVC , AKV , AKS
FROM (
    select Scode as SVC , row_number() over(partition by Tname order by (select 1)) rn  
    from #temp where Tname = 'SVC')  t1
INNER JOIN (
    select  Scode as AKV , row_number() over(partition by Tname order by (select 1)) rn 
    from #temp where Tname = 'AKV' )  t2
    on t1.rn = t2.rn
INNER JOIN (
    select  Scode as AKS , row_number() over(partition by Tname order by (select 1)) rn 
    from #temp where Tname = 'AKS' ) t3
    on t2.rn = t3.rn


--drop table #temp


Result:-


| SVC       | AKV       | AKS       |
|-------    |--------   |-------    |
| code2     | code1     | code3     |
| code3     | code12    | code2     |
| code3     | code3     | code1     |