No, it is not common to use 先生 (xiānsheng) in place of 老师 (lǎoshī) when
referring to a teacher in a school setting. In a school setting, 老师
(lǎoshī) is the appropriate term to use. 先生 (xiānsheng) is generally
used to address a male teacher in old times.
However, in modern times, 先生 (xiānsheng) can also be used as a polite
form of address for any adult male, not just teachers or scholars. Its
usage has expanded to address males in a general, respectful manner. So,
while it traditionally referred to teachers and scholars, it's not
limited to them in contemporary use.