title: Remove XML attribute based on value
body: <p>I have an XML variable with only one element in it. I need to check if this element has a particular attribute, and if it does, i need to check if that attribute has a specific value, and if it does, i need to remove that attribute from the XML element.</p>
  
  <p>So lets say I have </p>
  
  <pre><code>DECLARE @Xml XML
  SET @XML = 
  '&lt;person
      FirstName="Harvey"
      LastName="Saayman"
      MobileNumber="Empty"
  /&gt;'
  </code></pre>
  
  <p>The MobileNumber attribute may or may not be there, if it is, and the value is "Empty", i need to change my XML variable to this:</p>
  
  <pre><code>'&lt;person
      FirstName="Harvey"
      LastName="Saayman"
  /&gt;'
  </code></pre>
  
  <p>I'm a complete SQL XML noob and have no idea how to go about this, any ideas?</p>