One of two options:
In code, check for the Web Application (ID, URL, etc.) and use if/else/switch statements to go between code paths. This allows you to use a single solution for all Web Applications.
Create a new solution and port your code. Each solution has a GUID that is unique on a per-farm basis.