In Surface-enhanced Raman scattering (SERS), the Raman signal of a molecule adsorbed on a metal surface is enhanced by many orders of magnitude. This provides a "finger-print" of molecules which can be used in ultrasensitive sensing devises. Here we present a time-dependent density functional theory (TDDFT) study of the molecule-surface chemical coupling in SERS. A systematic study of the chemical enhancement (CHEM) of meta-and para-substituted pyridines interacting with a small silver cluster (Ag 20) is presented. We find that the magnitude of chemical enhancement is governed to a large extent by the energy difference between the highest occupied energy level (HOMO) of the metal and the lowest unoccupied energy level (LUMO) of the molecule. A two-state approximation shows that the enhancement scales roughly as (ωX/ωe)4, where ωe is an average excitation energy between the HOMO of the metal and the LUMO of the molecule and wX the HOMO-LUMO gap of the free molecule. Furthermore, we demonstrate that it is possible to control the CHEM enhancement by switching a dithienylethene photoswitch from its closed form to its open form. The open form of the photoswitch is found to be the strongest Raman scatterer when adsorbed on the surface whereas the opposite is found for the free molecule. This trend is explained using the simple two-state approximation.