Arduino Code/API to check board version

I am new to arduino. I am a software engineer, primarily focused on the Microsoft platforms, I have 15 years experience designing and developing applications.

Is there any method in the arduino libraries to have the sketch check, via and arduino api call, what board/processor that the sketch is currently running on. I am writing some holiday lighing automation code and will be using multiple ardiunos to control various aspects of the displays. I have both UNO Rev3 and the Mega Rev3 boards and will be using VIXEN to drive the lights. (I am open for other recommendations to use other software as long as it is free/opensource). I would like to write one sketch and deploy it to the boards, allowing the sketch to configure the pins appropriately.

In Pseudo code here is what I would like to have the sketch check:

If (boardtype == UNO)
{
set variables for PWM channels on 3,5,6,9,10,11
set variables for other channels as digital
}
elseif (boardtype == MEGA)
{
set variables for PWM channels on 2,3,4,5,6,7,8,9,10,11,12,13
set variables for other channels as digital
}

Thanks in advance! I am looking forward to learning from the community!

Is there any method in the arduino libraries to have the sketch check, via and arduino api call, what board/processor that the sketch is currently running on.

No. The hex code is built for a specific board, so there is no need to check, at run time, that the compiler did its job correctly.

I would like to write one sketch and deploy it to the boards, allowing the sketch to configure the pins appropriately.

That's a different requirement. Look at io.h for a list of preprocessor values you can use, like:

#elif defined (__AVR_ATmega2560__)

Thanks, I'll look at that header file!