Spontaneous symmetry breaking in curved spacetime