A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Check an alternative:
select *
from ( select UID, Currency, R_GrossAmt as [RETURN], S_GrossAmt as [CONTRIBUTION] from @TableA ) a
unpivot ( GrossAmt for Type in ( [RETURN], [CONTRIBUTION] ) ) u
order by UID, Type