title: Update multiple columns by ids
body: <p>I have tables called <code>tblPurchase</code> and <code>tblInvoice</code>. When I Insert new record I want to update my  <code>TotalStock</code> form <code>tblInvoice</code>. I tried following code.</p>
  <pre><code>Create procedure [dbo].[spUpdateTotalStock] @Stock int, @PurchaseId int 
  As
  Begin
      Begin Transaction
          Update tblPurchase 
          Set TotalStock = @Stock 
          Where PurchaseId = @PurchaseId 
  
          RollBack Transaction
      end
  </code></pre>
  <p>It worked as expected. But I want to update <code>TotalStock</code> column by many ids. It means when I insert more than one invoice at the same time, I want to update my <code>TotalStock</code> column. like this</p>
  <p><strong>tblInvoice</strong></p>
  <pre><code>ItemName | Quantity 
  ---------+----------
  Phone       3
  Mouse       6
  </code></pre>
  <p><strong>tblPurchase</strong></p>
  <pre><code>ItemName   | TotalStock
  -----------+------------
  phone           3
  Mouse           6
  </code></pre>
  <p><code>ID</code> comes with parameter. Always more than 10 ids come with parameter.</p>