title: if condition in sql server update query
body: <p>I have a SQL server table in which there are 2 columns that I want to update either of their values according to a flag sent to the stored procedure along with the new value, something like:</p>
  
  <pre><code>UPDATE
      table_Name
  
  SET
      CASE
          WHEN @flag = '1' THEN column_A += @new_value
          WHEN @flag = '0' THEN column_B += @new_value
      END AS Total
  
  WHERE
      ID = @ID
  </code></pre>
  
  <p>What is the correct SQL server code to do so??</p>