Missiles without any sensors on board will self destruct as soon as active sensor contact is lost.
If your missile has a sensor, it'll clear current target and move toward the last known target destination. If the sensor on board the missile picks up a target within range, that'll be the new target and destination. Turning your ship's sensor back on will not re-lock the missile back onto it's original target.
Thinking of ways I could use this for stealthy sniper boats, will a missile with a sensor simply target the nearest possible target in it's own sensor range at that point?
For example I have a ship flick on active sensors to unload a salvo at an enemy carrier vessel, and then flick off my actives to go back into "stealth" mode. Surrounding the carrier are a few smaller escort vessels, when the missile arrives at it's destination the onboard sensors can see all the enemy vessels but one of the escorts happen to be slightly closer than the carrier. Does this mean the entire salvo then decides to target that nearest escort ship?