Probably even better than z flashing would be a rubber membrane. Lowe's sells a roll about 8"-10" wide that should work great behind the ledger board. It cost about $12 for a 25 foot roll. This stuff works great and even seals nail holes. You could bend a piece of 10" roll flashing in place of the z flashing as an extra measure.
Derek