As long as you have a gear ratio low enough to allow you to pedal without having to strain, you shouldn't have any issue with your knees. So don't pedal up the hill in hard to pedal gears. If you have to stand, then you might be in a hard gear. Nothing against standing, but it's hard to stand in an easy gear, IMO.
Though you can get some knee pain if your feet are at the wrong angle. But you'd be experiencing that just pedaling whether going uphill or not.