declare @T table
(
OldID int,
OldParentID int,
NewID int,
NewParentID int
)
insert into @T
select 1, 0, 10, null union all
select 2, 0, 11, null union all
select 3, 2, 13, null union all
select 4, 3, 14, null
update T1
set T1.NewParentID = coalesce(T2.NewID, 0)
from @T as T1
left outer join @T as T2
on T1.OldParentID = T2.OldID