
with cte as (
		select id,len(attributevalue) originalValLen,
			substring(attributevalue,0,sp-1) +
			replace(substring(attributevalue,sp-1,ep-sp+2),':690,',':793,') +','+
			substring(attributevalue,sp-1,len(attributevalue)) updatedJson
		from (
			select pa.id,pa.AttributeValue, 
				CHARINDEX('"FieldId":690,',attributevalue) sp,
				CHARINDEX('},',attributevalue,CHARINDEX('"FieldId":690,',attributevalue)) ep
			from PanelAttributes pa
				join cptbl c on c.cpid=pa.PanelId and c.Deleted is null
			where attributekey like 'AdditionalAttributes'
				and AttributeValue like '%FieldId":690,%'
				and AttributeValue not like '%FieldId":793,%'
				and AttributeValue not like '%FieldId":690,"Value":""%'
			) z
)
update p
set p.attributevalue=cte.updatedJson
from PanelAttributes p
	join cte on cte.Id=p.id
