• SET @XML.modify('replace value of (Attribute/*[local-name()=sql:variable("@n")]/text())[1] with sql:variable("@v")')

    Seems to work ok. Thanks.