[Solved] Generate column Alias name dynamically in MS SQL Server [closed]


create procedure my_procedure (@col_alias varchar(100))
as
    declare @my_stmt nvarchar(max) = N'select 1+1 as ' + @col_alias
    exec sp_executesql @stmt = @my_stmt

exec my_procedure @col_alias="[This is a dynamix col alias]"

This is a dynamix col alias
---------------------------
2

15

solved Generate column Alias name dynamically in MS SQL Server [closed]