title: Invalid column name on stored procedure
body: <p>Here is my stored procedure in SQL Server 2014:   </p>
  
  <pre><code>CREATE PROCEDURE [dbo].[spSelectUserFromProfileUsers]
      @TableName NVARCHAR(20),
      @User NVARCHAR(20)
  AS
  BEGIN
      SET NOCOUNT ON;
  
      DECLARE @query NVARCHAR(MAX);
      SET @query = 'SELECT * FROM ' + QUOTENAME(@TableName) + ' WHERE  Users =' + @User
  
      EXECUTE sp_executesql @query
  END
  </code></pre>
  
  <p>and here is my code in Visual Studio:</p>
  
  <pre><code>if (TableFunctions.doesTableExist(ComboBoxSelectedProfile.SelectedItem + "Users", dbConnectionString))
  {
      // DynamicSQL
      using (SqlCommand command = new SqlCommand("spSelectUserFromProfileUsers", connection))
      {
          command.CommandType = CommandType.StoredProcedure;
  
          command.Parameters.AddWithValue("@TableName", ComboBoxSelectedProfile.SelectedItem + "Users");
          command.Parameters.AddWithValue("@User", TextBoxUserName.Text);
  
          command.ExecuteNonQuery();
      }
  }
  </code></pre>
  
  <p>and I'm getting the error: </p>
  
  <blockquote>
    <p>Invalid column name /Text that I entered the textbox/</p>
  </blockquote>
  
  <p>I've been looking for a solution a long time and I can't find anything, I'll appreciate your help very much!</p>