title: Insert variables into a SQL Server table in stored procedure
body: <p>I am trying to insert variables into SQL Server table dynamically inside a stored procedure but I'm not able to accomplish it because of the syntax. Can someone correct me what am I doing wrong in the below code. Thanks.</p>
  
  <p>Code I have tried:</p>
  
  <pre><code>SET @SQLStmt1 = N'INSERT INTO TestTable (TableName) 
                    VALUES(' + @ResulTableName + N')'
  EXEC sp_executesql @SQLStmt1    
  </code></pre>