How to update column in a table from another table based on condition?

Why to use sub-query when you can do that directly?

UPDATE st
  SET st.school_code = sc.school_id 
FROM master.student AS st
  JOIN Master.school AS sc
ON st.school_code = sc.school_code
WHERE sc.year=x
  AND st.year=x;

For more info See UPDATE (Transact-SQL)


UPDATE Master.Student
  SET school_code = sc.school_id 
FROM Master.school as sc
WHERE school_code = sc.school_code
  AND year = x
  AND st.year = x;

Try this query

UPDATE student SET school_code = c.school_id  
FROM student t
  INNER JOIN school c 
    ON t.school_code = c.school_code AND t.year = c.year
WHERE c.year=x