It sounds very much like what you are experiencing is runner's knee, known formally as patellofemoral pain syndrome. It is really classic of patellofemoral pain syndrome for their to be differential pain with certain activities, especially pain with sitting is quite classic.
Patellofemoral pain syndrome is essentially caused by improper gliding motion of the patella (knee cap) over the underlining leg bones (femur). This leads to pain and can cause some deterioration of the cartilage on the undersurface of the kneecap, worsening the pain.
There is no instant cure for patellofemoral pain syndrome, and surgical options while they do exist are usually not needed or helpful. The first step is to cut down on the high-impact exercise regimen that provokes the pain, as rest is essential to recuperation. Additionally, sometimes wearing a knee brace can help. In some people, over pronation at the foot is a factor which worsens or contributes to the pain, so wearing an orthotic shoe or a properly fitting athletic shoe can help. Finally, quadriceps strengthening exercises can be quite helpful, keeping in mind that all strengthening exercises should be performed with the leg straight (remember how it hurts when you have the knees bent while sitting or climbing stairs).
Talk to your primary care doctor
if the pain persists.