title: SQL Server + Dynamic Query 'Invalid Column Name'
body: <p>I am trying to execute the following dynamic query but I got an error: Invalid column name 'cat'</p>
  
  <pre><code> DECLARE @SQLDelQuery AS NVARCHAR(1200)   
   DECLARE @MemberNames varchar(50)
  
   SET @MemberNames = 'cat'
  
        SET @SQLDelQuery = 'SELECT [Email] FROM [aspnet_Membership] am
        INNER JOIN [aspnet_Users] u
        ON (am.UserId = u.UserId)
        INNER JOIN [Member] m
        ON (am.UserId = m.UserId)
        WHERE u.UserName IN (' + @MemberNames + ')
  
    EXECUTE(@SQLDelQuery)
  </code></pre>
  
  <p>If I change it to the normal query I am fine:</p>
  
  <pre><code>SELECT [Email] FROM [aspnet_Membership] am
    INNER JOIN [aspnet_Users] u
    ON (am.UserId = u.UserId)
    INNER JOIN [Member] m
    ON (am.UserId = m.UserId)
    WHERE u.UserName IN ('cat')
  </code></pre>
  
  <p>Anyone can point out my error? Thanks.</p>