So its important to note that the plastic case is not intended to prevent the PCM from getting wet. The PCM itself will be built to a standard such that it can withstand the amount of water it may see in its location. This failure is not a result of the plastic cover not doing its job, rather its a result of the connectors not doing their job.
That's a critical distinction because the only way water can reach the pins is through the connector housings, and those connectors should never allow water to reach those pins. I would inspect the connectors on the harness, look for failures in the seals. Simply replacing the PCM may open you up for this same issue again. Inspect the seals around the individual wires and around the edge of the housing.
Unfortunately I can't offer any guidance on how to program the new PCM
That's a critical distinction because the only way water can reach the pins is through the connector housings, and those connectors should never allow water to reach those pins. I would inspect the connectors on the harness, look for failures in the seals. Simply replacing the PCM may open you up for this same issue again. Inspect the seals around the individual wires and around the edge of the housing.
Unfortunately I can't offer any guidance on how to program the new PCM