title: Case Statement for TableName
body: <p>I want to create a stored procedure which updates table column based on sent condition. The queries which i wrote dont work.</p>
  
  <p>First is if I try to set Table name as variable.</p>
  
  <pre><code>Create Procedure Proc_Test
  @Tblname varchar(20)
  AS BEGIN
  
  Update @Tblname
  Set IsValid = 1;
  
  End
  </code></pre>
  
  <p>this fails. </p>
  
  <p>Second I have tried is case statement</p>
  
  <p>Create Procedure Proc_Test
      @Tblname varchar(20)
      AS BEGIN</p>
  
  <pre><code>Case @Tblname 
  WHEN 1 THEN Update tbl1 set ISValid = 1;
  
  WHEN 2 THEN Update tbl2 set ISValid = 1;
  
  End
  </code></pre>
  
  <p>END</p>
  
  <p>This also throws exception.</p>
  
  <p>Any other way to achieve this ?</p>