Which of these build numbers will tell me what version of SQL Server is installed on a server? The main Microsoft SQL Server 2008 R2 (64-bit) doesn't contain a version number in Programs and Features in Microsoft Windows Server 2008 R2:



To me it almost looks like I have SQL Server 2008 R2 RTM installed on the server since the version numbers match some of the other components listed, notably Microsoft SQL Server 2008 R2 Policies.  

My goal is to install SP2 but when I tried last night I got an error message concerning an unexpected version number.

Is there a way to use sqlcmd to find out what version it is?
Yes, you can query the database to find out the version via sqlcmd.

The actual SQL you'll want to use is just SELECT @@VERSION but to do it via sqlcmd, you can use:

sqlcmd -S[server] -U[user] -P[password] -q "SELECT @@VERSION"

Also check the MS sqlcmd reference for further info on flags you can use with sqlcmd.