If I am in the office I want server.mycompany.com to resolve to 192.168.2.2.
If I am in the wild I want server.mycompany.com to resolve to whatever mycompany.dyndns.com resolves to.
Windows 7. How can I do that?
You don't state whether or not this an office you have control over (a home office, for example). I'll assume you do have control.
Set up your in-office DNS server with your desired record. When you are out of the office, the DNS servers you get access to will use the the "normal" records.
As for how to do this? If your wireless or broadband router does not let you add specific DNS records (which would override the need to hit the internet to resolve server.mycompany.com), you will need to set up your own DNS server with that record, and then forward all other queries to the internet. To make a seamless switch between office and non-office, use DHCP in the office to feed your machine your own custom DNS server, otherwise your machine will be given some other name server when out in the wild.
There are lots of Windows DNS server solutions, free or otherwise. I'll leave that research to you.
If your office runs Simple DNS Plus (a DNS server for Windows), you can use the "NAT IP Alias" feature. This ensures that you get the private IP address when accessing the site from the LAN, but the public IP address when accessing from anywhere else. See http://www.simpledns.com/help/v52/wd_opt_dnsnatlan.htm