Can you deposit a check that isn't in your name?

I had my name changed (first and middle different, last name is the same). And I changed it to the new name on my bank accounts a couple months ago - but it has not been changed with my employer yet.

I just got a check from my employer - which of course has my old name on it. Can I still go deposit this check? Or do I have to change my name with my employer and have them write out a new check? What if I bring the court documents from my name change to the bank with me?