When master/professor is part of the title, then it is capitalised:
"Yes, Professor McGonagall."
However, that's pretty much the only occasion. When you simply refer to the professor, then you don't capitalise.
Likewise, terms of endearment are never capitalised. "Yes, honey." "No, love, that's not what I meant."
Polite address is never capitalised either. "No, miss, I was not aware." "Yes, sir."
When sir or madam become part of a title, however, they're capped: Professor Snape, Madam Pomfrey.
Sir/Lady/Lord are only capped as an honorary title: Sir Gallahad, Lord Thingy, Lady Ascot.
For more examples, see Writers' Resources at The Petulant Poetess.