Knee and Anlke pain
In your question, you mention that you have recently been experiencing knee and ankle pain from hiking. Reading it again, it sounds like you're almost trying to find the "right" kind of outdoor shoes because your knees and ankles hurt while you were hiking in sneakers. IMHO, getting a fancy pair of hiking shoes may or may not address the problem at all.
Rough Terrain and Ankles
If you're having ankle pain when you're hiking, and ONLY when you're hiking (i.e., your ankles are fine when you're jogging or working out in a gym), you may want to look at a pair of full hiking boots. The heavier kind. A well fitting pair of boots will have good ankle protection, and keep your ankles from rolling when you're hiking on rough terrain.
Knees
There's not going to be a single fix for knee pain, because knee pain can be caused by a variety of underlying issues. There is no particular kind of shoe (or boot) that is universally better for knees.
I (personally) have noticably less knee pain when I hike with a pair of 3rd party arch supports (I wear the blue "Superfeet" shoe inserts). Also, I have to make sure my shoes aren't too old, because I tend to wear the outside edge of my soles, and when that wears down too much my foot hits the ground at an angle. But I have issues with the arches of my feet. This may or may not apply to your situation, and there's no way to really diagnose it over the internet.
What you could try
You could play around with newer shoes and / or boots, with a 3rd party insert. First, wait until you're knees and ankles have settled down from whatever strain they went under on your last trip. Go to a store with a good return policy, and get fitted for a boot, and possibly shoe inserts. Wear them to work for a day or two, and if everything feels OK, try going on a short hike around your neighborhood. If everything is good, then try going on incrementally longer hikes.
If that doesn't work, or if you have knee or ankle pain that bothers you when you're not hiking (i.e, when you're at work or trying to sleep), then don't hesitate to see a doctor. A doctor may be able to tell if you have a specific foot issue that could be addressed with custom orthodics, or could prescribe a regiment of stretches and strengthening exercises that may help. (If the doctor immediately proposes surgery as a solution... go get a second opinion).