Insert into matching on a WHERE clause
update dbo.B 
set b.[ID] = a.orig_id
FROM dbo.A a
join dbo.B b
on b.[NUMBER] = a.number 
and b.[ID] &lt;&gt; a.orig_id


the &lt;> is so it can avoid taking a lock if the are equal