Assuming that you have a column that specifies the ordering, you can use an updatable CTE with a join:
with toupdate as (
select t.*, row_number() over (partition by name order by id) as seqnum
from t
)
update toupdate
set code = tu2.code
from toupdate join
toupdate tu2
on toupdate.name = tu2.name and
tu2.seqnum = 1 and
toupdate.seqnum > 1;
If you don't have a column that identifies the ordering of the rows, then your question doesn't make sense. In SQL, tables are inherently unordered.