SQL Server : dynamically select column based on another select column

join shbcf.ru