title: SQL Server : update multiple rows dynamically
body: <p>I want to update multiple rows in my database, the values might be different. Imagine this table:</p>
  
  <pre><code>Username   FirstName   LastName 
  -------------------------------
  user1      John        Doe 
  user2      Jane        Doe
  user3      bill        gates
  </code></pre>
  
  <p>If I want to update the table so it looks like this:</p>
  
  <pre><code>Username   FirstName   LastName 
  -------------------------------
  user1      John        Deer 
  user2      Jane        Farmer
  user3      Gill        Bates
  </code></pre>
  
  <p>Is it best to use one <code>UPDATE</code> statement for each user? Or is it possible to do this with one query?</p>
  
  <p>Also is it possible to put it in a stored procedure and provide a collection of values?</p>
  
  <p>Second question is it best to check if the values are changed before doing an update? Or just update everyone even if the value is the same? </p>
  
  <p>I am currently using SQL Server 2005 and C# for the application if that is relevant.</p>