INSERT INTO [IES].[T_GRATITUDE] (InsuredRigthProtectID, [Text])
SELECT t1.InsuredRigthProtectID, ''
FROM ies.T_INSURED_RIGTH_PROTECT t1
JOIN vclib.T_ENTITIES t2 ON (t1.type_ = t2.EntityID)
WHERE t2.EntName = 'GRATITUDE'
AND NOT EXISTS (
    SELECT 1
    FROM [IES].[T_GRATITUDE] g
    WHERE g.InsuredRigthProtectID = t1.InsuredRigthProtectID
)