I'm not a fan of sotware patents, but perhaps there's a halfway house towards getting rid of them:
Make software patents only holdable by a real person (i.e. not a corporation), and not transferable. Any money received from a patent infringement lawsuit would be paid to that named person.
That way, they can be used for their original purpose (to protect small inventors and allow them to build a larger business), but can't be collected by the trolls.
(It would also give companies an incentive to keep 'their' patent owners happy).
Just an idea... I'm sure there's a glaring hole in it somewhere.