You need a GP service on the server and the SDE connection needs to be on the server, as well. The script that the tool in the GPGeoprocessing Service uses will need to be told where to find the SDE conn file i.e. \\servername\folder\folder\your_sde_connection_file.sde\SDEfeatureclass
Assuming you are a user with permission to be on the server. I would not use the SOC account.
Here is greater detail on connecting to the server Use ACArcCatalog on your PC to make a connection to the server (use ACArcCatalog "Connect to Folder" to make the server connection under Folder Connections) you'll need to find your location/make a folder. Add the scripts and aan SDE connection file to this folder that you will copy/paste from ACArcCatalog Database Connections. Create the toolbox here. In ACArcCatalog section of GIS Servers (you may need to add yours) right click the server and "Add Service". Use the toolbox from your Folder Connections for your new GPgeoprocessing service.