Question: is it madam or sir?
Answer: Dear Sir or Madam is the customary ordering, which is reason enough to do it in a formal setting. But also consider the "rhythm" of the opening; sir has half the syllables as madam, and therefore it sounds better when sir is uttered first.