The solution to rotting sidewalls is a small piece of bent metal called a kick-out flashing (at roofing suppliers), which simply directs all that water away from the wall. It installs just like standard step flashing, except that half of it hangs over the edge of the roof.
Inspect the sidewall around and underneath the fascia and inside the house for signs of moisture damage, and repair any rotted areas. Add felt, if needed, before nailing the new wood on, and prime the new wood on all four sides before installing it.
Install the kick-out flashing underneath the first shingle (Photo 1). If the shingle already has flashing on it, the kick-out flashing has to slip beneath it, and you'll have to loosen or remove siding to do this. If the sidewall is stucco or solid wood like ours and you can't open it to get flashing behind it, continue the step flashing to the peak of the roof, then cover the step flashing with cap flashing (Photo 2).