Treat your professor in a formal manner, if you are in doubt. It is better to be safe than sorry, and no one has ever been offended by good manners.
Call them "doctor" if you know they have earned their PhD. Neglecting to call a professor by their proper title can be considered offensive by some.
Use first names only if you have been invited to do so. However, use discretion when addressing him by his first name. Just because you have been invited to use a first name does not mean other students have, or that your professor is comfortable with you doing so in front of colleagues.
Respond with "sir" or "ma'am" when answering a professor's questions.