If you are planning to upgrade the SCCM 2012 SP1 TO SCCM 2012 R2, then you have to upgrade the SCCM Agent as well. Therefore, you can use the SCCM Console itself to upgrade the agent in automatic mode. So the following steps will help you to make this success.
1- Open the SCCM Console and Click the Administration View
2- On the Overview Option Select the Sites
3- Select the Site from the results pane and on the Menu Bar Click the Hierarchy Setting Option as follows
4- Go to “Automatic Client Upgrade “Tab and Enable the option call “Upgrade Client Automatically When new client updates are available”.
5- Then you can specify the time period which you want Clients to upgrade automatically.
6- This will upgrade the Client Version as = 5.00.7958.1000
7- Also this will upgrade the R2 agent required Prerequisites on the client machines as well.