after investigate I found this solution to change the Mercurialscm to GitScm mantaining the information of the repository url, and the credentials of 1 pipeline, and i could extend the same to a list of piplines
import hudson.plugins.git.*;
def it = Jenkins.instance.getItemByFullName("test-pipeline-scm")
def definition = it.getDefinition()
String scriptPath = definition.getScriptPath()
String url = definition.getScm().getSource()
String credentials = definition.getScm().getCredentialsId()
def scm = new GitSCM(GitSCM.createRepoList(url, credentials),
Collections.singletonList(new BranchSpec("*/master")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null, Collections.emptyList())
def newDefinition = new org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition(scm, scriptPath)
it.definition = newDefinition
it.save()