请尝试以下解决方案。
SQL
Declare @xmlVal XML =
N'<r k="ABC">
<p k="Id">721</p>
<p k="ConnectionId">17150E3C-2D3B-4760-B392-0DF7563198D1</p>
<l k="param"/>
<l k="filter">
<l k="Default">
<p k="Id">123</p>
<l k="Exclude">
<l k="Exe">
<p k="__Id">efbef694-e86f-487b-9360-9596224c9908</p>
<l k="Criteria"/>
</l>
</l>
<p k="Family"></p>
</l>
</l>
<l k="Methods"/>
<l k="Groups"/>
<p k="Default"></p>
</r>';
SET @xmlVal.modify('replace value of
(r/p[2]/text())[1]
with "2BDFF1B4-33CD-4CF9-9AD6-17F28C2F03E0"');
-- test
SELECT @xmlVal;