これがお役に立てば幸いです
declare @temp table
(id1 nvarchar(99), id2 nvarchar(99), value int)
insert into @temp values ('tyb','uanwe_A',6963)
insert into @temp values ('tyb','uanwe_B',979 )
insert into @temp values ('tyb','uanwe_C',931 )
select id1, substring(id2,1, 5) id2,
max(case substring(id2,7, 1)
when 'A' then value end) vA,
max(case substring(id2,7, 1)
when 'B' then value end) vB,
max(case substring(id2,7, 1)
when 'C' then value end) vC
from @temp GROUP BY id1,substring(id2,1, 5)