Theorem 2.8 on p. 30 of *Models for smooth infinitesimal analysis* by Moerdijk and Reyes. The theorem works with $C^\infty$ rings, which are a bit more general than algebras of functions. The advantage is that the proof is short.