title: How to take table name as an input parameter to the stored procedure?
body: <p>I have a small stored procedure below. </p>
  
  <p>I am taking the table name as an input parameter to the stored procedure so that I'm planning to insert the data into the temp table and display the same. This is just a tiny code block of my project stored procedure. </p>
  
  <p>When I am compiling the below, it is considering the parameter in the select statement as a table variable and throwing the error as:</p>
  
  <blockquote>
    <p>Must declare the table variable "@TableName".</p>
  </blockquote>
  
  <p>SQL:</p>
  
  <pre><code>CREATE PROCEDURE xyz @TableName Varchar(50) 
  AS 
  BEGIN 
  SELECT TOP 10 * INTO #Temp_Table_One 
  FROM @TableName 
  
  SELECT * FROM #Temp_Table_One 
  END
  </code></pre>