You have two choices:
1. Set up an indoor trainer so your front wheel is elevated about four inches. This puts your bike, and hence your body, in a position similar to what you'd experience on a real climb. This is important because the way you pedal and the muscles you use to support yourself on the bike are slightly different when you're going uphill. You need to get used to riding at a high sustainable power output in this position, rather than just focusing on developing power riding flat and hoping all that power will be accessible once you start going uphill.
2. Ride into a headwind. While this will not give you the same body position as elevating the front of the bike, riding into a stiff headwind helps build climbing strength by making you pedal against increased resistance at a relatively low speed. You can ride at high power output on flat ground, but that typically results in high speed and high cadence. Against a strong headwind, you're more likely to be pushing a lower gear at a lower cadence and not going very fast, despite a high power output. This scenario sounds a lot like climbing a big hill, doesn't it?
It's important to realize, however, that the most important thing you can do to improve climbing power is to work on intervals that increase your maximum sustainable power. Even if you're training primarily on flat ground, a great deal of the fitness you gain will transfer just fine to riding uphill. The climbing-specific techniques and body positions will help you go faster uphill, but these adaptations are secondary to gaining aerobic fitness.