Are both of these correct?

For speaking to a stranger or a professional: Was sind Sie von Beruf?
For speaking to a friend: Was bist Du von Beruf?

Or, would I always use the former?