Skip to content

SQL Stored Procedure Naming Convention

Scope: Project-specific finding — applies to the SQL codebase analyzed during this session.

Convention

All SQL stored procedures in this codebase follow a strict naming pattern:

usp_[Module]_[Action]_[Version]

Components

Segment Description Example
usp Prefix standing for "User Stored Procedure" (fixed) usp
Module The functional domain or bounded context the procedure belongs to Orders, Auth
Action The operation performed (verb or verb phrase) GetById, Insert
Version An integer or string suffix indicating the procedure version v1, v2

Full example: usp_Orders_GetById_v2

Critical Rule: Deprecation Signal

Any stored procedure that is missing the _[Version] suffix is a deprecated legacy entry point.

These unversioned procedures (e.g., usp_Orders_GetById) represent historical entry points that have been superseded by versioned equivalents. They should not be relied upon for new integrations and may be removed or altered without notice.

Implications for Analysis

  • When performing SQL topology discovery or dependency mapping, versioned and unversioned procedures must be tracked separately.
  • Unversioned procedures should be flagged in any inventory or findings report as DEPRECATED.
  • Callers of unversioned procedures should be considered technical debt candidates.
  • This convention is undocumented in the codebase itself — it was discovered through empirical analysis and must be preserved here to guide future agents.

Discovery Date

2026-03-13