Hi Friends,
Here is what I have tried,
DECLARE @query VARCHAR(1000)=null;
SET @query = 'ID';
IF((select phone1 from tablename where id = 1459) > 0)
SET @query += ',phone1';
IF((select phone2 from tablename where id = 1459) > 0)
SET @query += ',phone2';
..
..
..
IF (@query IS NOT NULL)
exec('SELECT '+@query+' FROM tablename WHERE id = 1459');
I do not know whether the above solution is optimal or not but it gives me expected answer.So I selected the above method.
Hope this may help someone too.
Regards,
RK