It shouldn't change, but why hardcode?
I would put the OrgId in a custom setting, and read it from there. That way you can test in Sandboxes, work in Prod and, if it ever changes, it's 5 minutes to modify without any code "movement".
UPDATE
There are a few things you can do that do not involve hardcoding... hopefully one of them will work
- To log into production you hit
login.salesforce.com
, sandbox istest.salesforce.com
. Perhaps you can identify your environment because of that. - Alternatively, you can call a method in SFDC to return whether the org you're hitting is "Prod" or Sandbox". A simple SoQL query will return that:
select Id, IsSandbox from Organization limit 1
. See herehere for more details.