Perform below two single point calculations (geometry should be optimized first):
(1) # M052X/6-31G*
(2) # M052X/6-31G* scrf=SMD
Then substracting E_1 from E_2, you will obtain solvation free energy (298.15K) in water using the popular SMD solvation model. Justification of this calculation manner can be found in J. Phys. Chem. A 2010, 114, 13442. For more information about SMD, please check original paper of SMD (J. Phys. Chem. B 2009, 113, 6378). M052X/6-31G* is the best level for evaluating solvation free energy with SMD.
In analogy with the approach nicely provided by professor Lu, you can simply calculate solvation free energy, e.g. at B3LYP/6-31G(d) computational level, as follows:
1- Perform optimization in the gas phase followed by frequency calculation to ensure there is not any imaginary frequency if your structure is a local minimum, i.e. "#B3LYP/6-31G(d) opt freq".
2- Perform a single point energy calculation over the gas phase optimized geometry using "#B3LYP/6-31G(d) scrf(pcm,smd,sc,solvent=XX,dovacuum)". Note that "XX" denotes your desirable solvent.
At the end of calculation where the "Self-consistent C-PCM results" are reported, you can find solvation free energy as "DeltaG (solv) (kcal/mol)=YY".
The popular solvent models are Onsager and IEF-PCM. Please refer to a outstanding book as follow: https://chemistry.fudan.edu.cn/_upload/article/files/81/27/040931c841b49c61ab6c2f7e144a/924bdd80-e6a1-40b5-8546-ab535bac2e92.pdf
or
Book Exploring Chemistry With Electronic Structure Methods, 3rd edition
Dang T. Nguyen Onsager model is completely out-of-date. It is an extremely crude model, since it simply represents the solute cavity as a sphere without detailed structural character, and the reaction field is only dependent of dipole moment of solute. Onsager can at most be used for very small polar solutes, such as H2O, H2CO, etc., it lacks practicality for most systems.
IEFPCM is much more advanced than Onsager, however, its original definition doesn't explicitly take nonpolar part of solute-solvent interaction into account, which is never negligible in evaluating energy of solute in the solvation phase, therefore though IEFPCM is a very good choice for most cases such as geometry optimization and frequency analysis, it is deprecated for evaluating energy purpose, in this case SMD is much more recommended since nonpolar part is well-defined.
But SMD also has a notable shortcoming. Its accuracy in calculating solvation free energy of ionic systems is not very ideal. In this regards, the uESE solvation model proposed recently is quite promising, I have a blog article to introduce and show how to use this model: http://sobereva.com/593 (in Chinese).