Thanks to all,Sorry I was away, and I got the it ,Thanks for your support
here I am posting the method I used,It is dynamic un pivot
so we don't need hard coding of column/raw name
step1.Create table and insert values
CREATE TABLE test
([Elements] varchar(10), [Jan] int, [Feb] int, [March] int, [April] int) ;
INSERT INTO test
([elements], [Jan], [Feb], [March], [April]) VALUES ('ABC', 100, 200, 300, 400), ('XYZ', 200, 300, 400, 500), ('PQR', 500, 400, 300, 200) ;
Step2. The query to arrange rows to columns and vice versa
DECLARE @colsUnpivot AS NVARCHAR(MAX),
@query AS NVARCHAR(MAX),
@colsPivot as NVARCHAR(MAX)
select @colsUnpivot = stuff((select ','+quotename(C.name)
from sys.columns as C
where C.object_id = object_id('test') and
C.name <> 'Elements'
for xml path('')), 1, 1, '')
select @colsPivot = STUFF((SELECT ','
+ quotename(Elements)
from test t
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)')
,1,1,'')
set @query
= 'select name, '+@colsPivot+'<mailto:'+@colspivot+'>
from
(
select Elements, name, value
from test
unpivot
(
value for name in ('+@colsUnpivot+'<mailto:'+@colsunpivot+'>)
) unpiv
) src
pivot
(
sum(value)
for Elements in ('+@colsPivot+'<mailto:'+@colspivot+'>)
) piv'
exec(@query);
Thanks