It really comes down to a few factors, many of which have been mentioned:
1. good bike fit - mainly saddle height, saddle fore/aft and cleat alignment (pedals with excessive float are not necessarily a good thing - a specific muscle in the back of the knee that works to keep the roation of your upper and lower leg aligned is particularly stressed in this case)
2. cadence - 80-100rpm, hills or no hills. yes, standing will drop cadence further, but this is fine as overall torque on the knee is greatly reduced during standing vs seated at the same cadence/power output.
3. muscular strength and flexibility imbalances - this one is the cause much more often than most realize. this includes muscles of the calf, the quads, the hamstrings, the glutes, the hip rotators (!!!) and the hip flexors (upper quads). a muscle needent be attached to the knee to impead proper tracking and alignment of the knee joint.
The best way to know for sure is to get a bike fit with someone who has an extensive background (by which I mean more than experience in a local bike shop) or see a physical therapist/sports medicine professional.
It's worth it!