Yes, you can still use the W-2 with your old name on it, as long as the Social Security Number is correct.