O primeiro passo é executar a query na base do cliente


select 1Qry+myXML+2Qry from (
select 
  'Update Nfce set xml=''' as [1Qry],
  cast( [QuerReplace] as nvarchar(max)) as [myXML],
  ''' where nfceId='+cast( NFCeID as nvarchar(max)) as [2Qry]
from (SELECT
(SELECT REPLACE(cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID) as nvarchar(max)),SUBSTRING(cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID) as nvarchar(max)), CHARINDEX('<Id>',cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID)as nvarchar(max))),(CHARINDEX('</Id>',cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID)as nvarchar(max))) + 5)-(CHARINDEX('<Id>',cast((select xml from nfce as tb where tb.nfceid = NFCe.NFCeID)as nvarchar(max))))),'')) as [QuerReplace],
NfCeID

from
NFCe

where nfceID in (select NFCeID from NFCe where xml like '%><id>%')) as cons

) as Cons


Copiar código gerado e executar