Transact-SQL System Stored Procedures
Replication system stored procedures and replication agent executable files are documented and available as a method for implementing replication in special circumstances or for use in batch files and scripts. In most cases, however, you are better served by using the programming interfaces SQL-DMO and replication Microsoft® ActiveX® controls for programming replication rather than writing direct calls to the system stored procedures.
An advantage to using scripts based on system stored procedures is that you can implement replication, create publications and subscriptions on a server, generate the script automatically through SQL Server Enterprise Manager, and then use that script at other servers to implement replication components. Executing a script can be faster and more efficient than manually performing the same steps repeatedly using SQL Server Enterprise Manager.
For more information, see Scripting Replication.