update t
set t.TemplateData = stuff(t.TemplateData, 
                            CharIndex(';', t.TemplateData,
                                    CharIndex('@bo->{MedicalExamination} := (@ap.GetInstance("AKUZ.MEDICAL_EXAMINATION', t.TemplateData)), 1, ';     if(@bo->{ObjectProperties / ObjectTypeID} IS "AKUZ.DOCTOR_VISIT")
    begin()
    @bo->{MedicalExamination / DoctorVisitNewLink} := @bo;
    end;')
from VCLib.T_DATAFORM_TEMPLATE t
join VCLib.T_ENTITIES e on e.EntityID =t.Entities
where t.LastUsageDateTime > '20250101'
and t.TemplateData like '%@bo->{MedicalExamination} := (@ap.GetInstance("AKUZ.MEDICAL_EXAMINATION%'
and e.EntName <>'PROTOCOL_PEDIATRIST'

