title: Replace an attribute name in an Xml column with a SQL query
body: <p>I need to replace the attribute's name "TimeStamp" by "Timestamp" in the following XML example :</p>
  
  <pre><code>&lt;CMD CommandID="6000"&gt;
     &lt;DATA&gt;
        &lt;ReportData Key="10000"&gt;
           &lt;Event TimeStamp="2013-03-07 15:42:49.000" Name="ABC" /&gt;
           &lt;Event TimeStamp="2013-03-07 15:42:50.000" Name="DEF" /&gt;
           &lt;Event TimeStamp="2013-03-07 16:22:03.000" Name="GHI" /&gt;
        &lt;ReportData&gt;
     &lt;DATA&gt;
  &lt;CMD&gt;
  </code></pre>
  
  <p>It is stored in a SQL Server 2008 database within a column of <code>XML</code> type.</p>
  
  <p>I tried something like this but it's incorrect:</p>
  
  <pre><code>DECLARE @variable NVARCHAR(20) = 'Timestamp'
  
  UPDATE MyDatabase.dbo.MyTable
  SET MyXmlColumn.modify('replace value of (/CMD/DATA/ReportData/Event/@TimeStamp) with sql:variable("@variable") ')
  </code></pre>
  
  <p>Thank you for your help.</p>