Evolution of interorbital superconductor to intraorbital spin-density wave in layered ruthenates