• It's possible with using Dynamic Sql. Here just a small sample, but you should be able to get your one from here:

    -- that could be your proc input parameter:

    DECLARE @ColumnName NVARCHAR(100)

    SET @ColumnName = 'Name'

    ------------------------

    DECLARE @SQL NVARCHAR(4000)

    -- let's call it template:

    SET @SQL = N'SELECT ~ FROM sys.tables'

    -- note use of QUOTENAME to prevent sql injection, also it will good for your columns name as it wrap them into []

    SET @SQL = REPLACE(@SQL,'~',QUOTENAME(@ColumnName))

    EXEC sp_executesql @SQL

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]