See
How to return a value from dynamicaly executed T-SQL code FAQ #8130
>I can't remember the proper syntax in SQL Server 2000 for something similar to macro substitution.
>
>ie; I have a variable: @column_name varchar(30) that contains the name of a column in the customer table.
>
>I need to: set mvalue = (select @column_name from customer) (I know this is not the right syntax) and have the value of the column come into the variable mvalue.
>Thanks.
--sb--