If your position is at risk, then there are avenues for you to consider. But you need to plan in advance. People have far more options when planning in advance as opposed to reacting to a change. Consider the following items:
1. Understand the Business and Add Value
To position yourself for the future, you must understand the organization, where it is going and how to support it. Being a developer in a corner isn't a very secure hedge against risk. Being able to talk with business people, document requirements, and help shape direction -- those are tasks that will exist because outsourcing necessitates solid project management and software engineering practices.
2. Do Not Make Yourself a Liability!
Be extremely cautious of making yourself a risk -- whether real or perceived. The knee-jerk reaction of many technology people is to hoard information and make themselves seem indispensable.
The problem with this is that many organizations, especially large ones, must identify this as a risk and take appropriate action. Even if the person has no intent of leaving, the danger is that if he/she becomes sick, then the organization will be impacted. As a result, information hoarding can have the exact opposite effect today -- rather than making a person indispensable, it forces the organization to mitigate the risk and that may entail dismissing the person.
3. Never Stop Learning
Never stop learning. Even if your employer doesn't pay for training, find a way to get it. If you are in the unfortunate position of being with a company that doesn't develop its people, realize that should whatever unfortunate situation happen, you could wind up on the job market with an obsolete skill set. Taking the more optimistic route, think of it this way: It is better to be prepared for an opportunity and not have the opportunity materialize than it is to have an opportunity and not be prepared to take advantage of the opportunity.
4. Switch Functional Areas
This one may seem obvious, but if your current position is ripe for outsourcing, then consider bidding on positions that are not so easily outsourced. To do so may require an investment in education on your part, a cut in pay, etc. It is up to you to decide what it is worth to stay with your present employer and then act accordingly.
5. Develop your own list!
As mentioned earlier, it is better to plan in advance. Literally write down all of your options and investigate them. Identify the options using some kind of priority system that allows you to identify which are the best to pursue. If you have trusted friends, consider comparing notes -- but only do this if you know everyone is talking about being outsourced. You don't want to start a panic if nothing is happening. However, it is a good thing to track your options and be prepared.
There are many issues surrounding outsourcing -- whether local or offshore. If you are with a firm that is considering outsourcing or the industry trend is toward outsourcing, there are risks that need to be managed. The important task for you is to not only be aware of the environment that your firm faces and the way your management team reacts to those types of risks, but also to understand what you must do to compensate for the risks you face. As mentioned earlier, it is far better to be prepared than not to be.