There are two (2) types of spray foam:
1) Open cell low density spray foam
2) Closed cell high density spray foam
Open cell foam is recommended for use mainly in commercial applications. The material is less expensive but requires more depth to achieve vapor barrier.
Closed cell foam has the highest R-value available in insulation materials. Spray foam is not the only or recessarily the best insulation material. There are a number of different options that are less costly than foam and are also quite effective in achieving the comfort you desire.