title: Incorrect syntax near the keyword 'Truncate'. Must declare scalar variable '@table'
body: <p>I'm quite new to SQL and I'm not sure why the following code is producing the error in title:</p>
  
  <pre><code>CREATE PROCEDURE Truncate (@table varchar(50))
  AS
  BEGIN
      SET NOCOUNT ON;
      EXEC ('TRUNCATE TABLE ' + @table);
  END
  </code></pre>