No built in pre-processor directive as far as I know, but there is an MSBuild variable.
Open the project file (unload it in Solution Explorer, then click edit) and add the following after the main set of property declarations.
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'">
<DefineConstants>$(DefineConstants);VS_10;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'">
<DefineConstants>$(DefineConstants);VS_11;</DefineConstants>
</PropertyGroup>
You can then use the VS_10
(VS 2010) or VS_11
(VS 2012) preproc directives.